package com.example.demo.service;



import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.example.demo.Dao.customerdao;
import com.example.demo.bean.customer;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service //将类交由spring管理
public class customerService {

    @Autowired
    private  customerdao customerdao;


        public int Insertcustomer(customer customer){
             customerdao.insert(customer);return 1;
        }


        public int Deletecustomer(Integer customerid){
//            QueryWrapper<customer> wrapper = new QueryWrapper<>();
//            wrapper.eq("customerid",customerid);
            customerdao.deleteById(customerid);
//             customerdao.deleteById(customerid);
             return 1;
        }


        public int Updatecustomer(customer customer) {
             customerdao.updateById(customer);return 1;
        }

//        public List<customer> ShowAllcustomer() {
//            return customerdao.se();
//        }

        public customer Showcustomer(Integer number){
            return customerdao.selectById(number);
        }
        public List<customer> ShowAllcustomer(){
        return customerdao.ShowAllcustomer();
    }
    }

